package com.niit.controller;

import com.niit.model.*;
import com.niit.service.StudentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author： 雷雨
 * @date: 2021/6/16
 * @description:
 *      调用service层的方法
 * @modified:
 * @Version: 1.0
 */
@RestController
@RequestMapping("/student")
public class StudentConsumerRestController {
    @Resource
    private StudentService studentService;

    @GetMapping("/class/{id}")
    public List<Classes> getClassById(@PathVariable("id")Long id){
        return studentService.getClassById(id);
    }
    @DeleteMapping("/class/{id1}/{id2}")
    public String deleteClassById(@PathVariable("id1")Long id1,@PathVariable("id2")Long id2){
        return  studentService.deleteClassById(id1,id2); }
    @GetMapping("exampaper")
    public List<ExamPaper> list(@PathVariable("id")Long id){
        return studentService.list(id);
    }
    @GetMapping("exampaper1")
    public List<ExamPaper> list1(@PathVariable("id")Long id){
        return studentService.list1(id);
    }
    @GetMapping("exampaper2")
    public List<ExamPaper> list2(@PathVariable("id")Long id){
        return studentService.list2(id);
    }
    @GetMapping("/exampaper/{id}")
    public ExamPaper getExamPaperById(@PathVariable("id")Long id){
        return studentService.getExamPaperById(id); }
    @GetMapping("/exampaper1/{id}")
    public ExamPaper getExamPaperById1(@PathVariable("id")Long id){
        return studentService.getExamPaperById1(id); }
    @GetMapping("/exampaper2/{id}")
    public ExamPaper getExamPaperById2(@PathVariable("id")Long id){
        return studentService.getExamPaperById2(id); }

    @GetMapping("/student/{id}")
    public Student getStudentById(@PathVariable("id")Long id){
        return   studentService.getStudentById(id);
    }
    @PutMapping("/student")
    public String update(@RequestBody Student student){
        return studentService.update(student);
    }
    @GetMapping("/paper/{id}")
    public  List<StudentPaper> selectStudentPaperById(@PathVariable("id")Long id){
        return studentService.selectStudentPaperById(id);
    }
    @GetMapping("studentpaper")
    public List<StudentPaper> list(StudentPaper studentPaper){
        return studentService.list(studentPaper);
    }
    @PostMapping("/testIn")
    public String add(@RequestBody StudentPaperQuestionAnswer studentPaperQuestionAnswer){
        return studentService.add(studentPaperQuestionAnswer);}
    @PutMapping("/testIn")
    public String update(@RequestBody StudentPaperQuestionAnswer studentPaperQuestionAnswer) {
        return studentService.update(studentPaperQuestionAnswer);
    }
    @GetMapping("/testIn/{id1}/{id2}")
    public StudentPaperQuestionAnswer select1(@PathVariable("id1")Long id1,@PathVariable("id2")Long id2){
        return  studentService.select1(id1,id2);
    }
    @GetMapping("/paperQuestion/{id1}/{id2}")
    public PaperQuestion select(@PathVariable("id1")Long id1,@PathVariable("id2")Long id2){
        return  studentService.select(id1,id2);
    }








}
